<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .a{
            width: 300px;
            height: 300px;
            border: 10px solid #000;
            margin: 100px;
        }
    </style>
</head>
<body>

    <div class="a"></div>

    <script>

        // 盒子的距离
        //   clientWidth / clientHeight
        //   offsetWidth / offsetHeight 
        //   offsetLeft / offsetTop     距离最近的具有定位的祖先元素的距离   (自身不需要定位)


        var oDiv = document.querySelector('div');
        console.log(oDiv.offsetLeft);

    </script>
    
</body>
</html>